package com.nthink.indicators.controller;

import com.nthink.indicators.pojo.operationindex.assetoperation.AssetData;
import com.nthink.indicators.pojo.sunburst.DataModel;
import com.nthink.indicators.service.hospitalindicators.HospitalIncomeService;
import com.nthink.indicators.service.operationindex.AssetService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * @author Angus Yu
 * @date 2021-03-31 16:23
 */
@Api(tags = "资产运营")
@RestController
public class AssetController {

    @Autowired
    private AssetService assetService;

    @Autowired
    private HospitalIncomeService hospitalIncomeService;

    @ApiOperation("资产运营（财务科）基础数据")
    @GetMapping("/getAssetData")
    public AssetData getAssetData(@RequestParam(required = false) Date startTime, @RequestParam(required = false) Date endTime) {
        return assetService.getAssetData(startTime, endTime);
    }

    @ApiOperation("资产运营（财务科）全院收入一览")
    @GetMapping("/getHospitalAssetIncome")
    @ResponseBody
    public List<DataModel> getHospitalAssetIncome(@RequestParam(required = false) Date startTime, @RequestParam(required = false) Date endTime) {
        return hospitalIncomeService.getHospitalIncome(startTime, endTime);
    }
}
